package vip.zhenzicheng.jvm.jvmbook.part2;

import java.util.ArrayList;
import java.util.List;

/**
 * 测试堆内存溢出
 * VM Args：-Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError
 *
 * @author zhenzicheng
 * @date 2022-07-15 17:10
 */
public class HeapOOM {

  static class OOMObject {
  }

  public static void main(String[] args) {
    List<OOMObject> list = new ArrayList<>();

    while (true) {
      list.add(new OOMObject());
    }
  }
}
